<template>
	<!-- 企业认证 -->
	<div class="c-authen">
		<div class="detail-nav font13 h99">
			<span @click="goback()" class="cur">{{$t('common.newJob.enterpriseCenter')}}</span>
			<span>&gt;</span>
			<span v-if="type==1">{{$t('common.detail.enterpriseCert')}}</span>
			<span v-else>{{$t('common.company.improveInfo')}}</span>
		</div>
		<div class="c-authen-content">
			<!-- LOGO -->
			<div class="company-userinfo-head flex">
				<div class="company-userinfo-head-img flexCenter">
					<img :src="imgs1" alt="" v-if="imgs1!=''"/>
					<span v-else>LOGO</span>
				</div>
				<div class="company-userinfo-head-text flexColumn">
					<p class="h99">{{$t('common.company.companytask4')}}</p>
					<p class="h99">{{$t('common.company.companytask5')}}</p>
					<el-upload action="" :before-upload="logoUpload">
						<span class="color1">{{$t('common.company.upload')}}</span>
					</el-upload>
				</div>
			</div>
			
			<!-- 企业资质信息 -->
			<div class="c-authen-box">
				<div class="c-authen-title flexItems">
					<div class="zmlTitle">{{$t('common.company.companyQualification')}}</div>
					<span class="color3" style="margin-left: 8px;">({{$t('common.company.companytask7')}})</span>
				</div>
				<div class="company-userinfo-head flex">
					<div class="company-userinfo-head-img flexCenter">
						<img :src="imgs2" alt="" v-if="imgs2!=''"/>
						<span v-else>{{$t('common.detail.enclosure')}}</span>
					</div>
					<div class="company-userinfo-head-text flexColumn">
						<p class="h99">{{$t('common.company.companytask4')}}</p>
						<p class="h99">{{$t('common.company.companytask8')}}</p>
						<el-upload action="" :before-upload="intelligenceUpload">
							<span class="color1">{{$t('common.company.upload')}}</span>
						</el-upload>
					</div>
				</div>
			</div>
			
			<!-- 企业基本信息 -->
			<div class="c-authen-box">
				<div class="zmlTitle">{{$t('common.company.companyInfo')}}</div>
				<div class="c-authen-informa">
					<table>
						<tr>
							<td class="w1">
								<div class="flexItems">
									<label class="lab">{{$t('common.company.companyName')}}：</label>
									<el-input v-model="formData.enterpriseName" maxlength="20"><span slot="suffix" class="el-input__icon"></span></el-input>
								</div>
							</td>
							<td class="w2">
								<div class="flexItems">
									<label>{{$t('common.company.companyCode')}}：</label>
									<el-input v-model="formData.uscc"  maxlength="18" @input="jsUscc()" />
								</div>
							</td>
							<td class="w3">
								<div class="flexItems">
									<label>{{$t('common.company.companyLegal')}}：</label>
									<el-input v-model="formData.lawPerson"  maxlength="20" />
								</div>
							</td>
						</tr>
						<tr>
							<td class="w1">
								<div class="flexItems">
									<label class="lab">{{$t('common.company.companyCapital')}}：</label>
									<el-input v-model="formData.registeredCapital" maxlength="20"><span slot="suffix" class="el-input__icon">{{$t('common.tips.thousand')}}</span></el-input>
								</div>
							</td>
							<td>
								<div class="flexItems">
									<label>{{$t('common.company.companyDate')}}：</label>
									<el-date-picker
										id="establishmentDate"
										class="cur"
									  v-model="formData.establishmentDate"
									  type="date"
									  :placeholder="this.$t('common.form.select', [$t('common.company.companyDate')])">
									</el-date-picker>
								</div>
							</td>
							<td class="w3">
								<div class="flexItems">
									<label>{{$t('common.company.companyType')}}：</label>
									<el-select v-model="formData.corporateType" :placeholder="this.$t('common.form.select',[])" :popper-append-to-body = "false">
									  <el-option
									    v-for="(item,index) in corporateTypeList"
									    :key="index"
									    :label="item.text"
									    :value="item.value">
									  </el-option>
									</el-select>
								</div>
							</td>
						</tr>
						<tr>
							<td class="w1">
								<div class="flexItems">
									<label class="lab">{{$t('common.company.companyEmployees')}}：</label>
									<el-select v-model="formData.staffNumber" :placeholder="this.$t('common.form.select',[])" :popper-append-to-body = "false">
									  <el-option
									    v-for="(item,index) in staffNumberList"
									    :key="index"
									    :label="item.text"
									    :value="item.value">
									  </el-option>
									</el-select>
									<!-- <el-input v-model="formData.staffNumber"><span slot="suffix" class="el-input__icon">{{$t('common.tips.people')}}</span></el-input> -->
								</div>
							</td>
							<td>
								<div class="flexItems">
									<label>{{$t('common.company.companyIntellectual')}}：</label>
									<el-input v-model="formData.ipcount" maxlength="20"><span slot="suffix" class="el-input__icon">{{$t('common.tips.a')}}</span></el-input>
								</div>
							</td>
							<td>
								<span class="h99">（{{$t('common.company.companytask1')}}）</span>
							</td>
						</tr>
						<tr>
							<td colspan="3">
								
								<div class="flex-lect" style="width:100%">
									<label class="lab">{{$t('common.resume.belongJob')}}：</label>
									<div class="cur industryBox" @click="industryPup(3)">
										{{formData.industryTxt}}
									</div>
									
									<!-- <el-select v-model="formData.industry" :placeholder="this.$t('common.form.select',[])" :popper-append-to-body = "false">
									  <el-option
									    v-for="(item,index) in industryTypeList"
									    :key="index"
									    :label="item.text"
									    :value="item.value">
									  </el-option>
									</el-select> -->
								</div>
							</td>
						</tr>
					</table>
					<div class="table-row flex">
						<label class="lab">{{$t('common.foot.address')}}</label>
						<div class="table-row-right">
							<el-input v-model="formData.address" maxlength="200"><span slot="suffix" class="el-input__icon"></span></el-input>
						</div>	
					</div>
					<div class="table-row flex">
						<label class="lab">{{$t('common.company.companyBusiness')}}：</label>
						<div class="table-row-right">
							<el-input type="textarea" v-model="formData.enterpriseInfo" resize="none" maxlength="200" />
						</div>	
					</div>
					
					<div class="table-row flex">
						<label class="lab">{{$t('common.company.companyTags')}}：</label>
						<div class="table-row-right">
							<div class="table-row-tags">
								<el-tag
								  :key="index"
								  v-for="(tag,index) in enterpriseTagListed"
								  closable
								  :disable-transitions="false"
								  @close="handleClose(tag)">
								  {{tag.text}}
								</el-tag>
								<el-input
								  class="input-new-tag"
								  v-if="inputVisible"
								  v-model="inputValue"
								  ref="saveTagInput"
								  size="small"
								  @keyup.enter.native="handleInputConfirm"
								  @blur="handleInputConfirm">
								</el-input>
								<span class="add-btn" @click="addBtn({type:1})">+{{$t('common.detail.addTags')}}</span>

							</div>
						</div>	
					</div>
				</div>
			</div>
			
			<!-- 核心技术与产品方向 -->
			<div class="c-authen-box">
				<div class="c-authen-fx flexItems flexBetween">
					<div class="zmlTitle">{{$t('common.company.companyDirection')}}</div>
					<div class="flexItems color1" @click="addCPList()"><i class="el-icon-circle-plus-outline color1" style="margin-right: 5px;"></i>{{$t('common.detail.add')}}</div>
				</div>
				<div class="c-authen-jishu" v-for="(item,index) in formData.technologyDirectionList" :Key='index'>
					<div class="table-row flex">
						<label class="flexItems">{{$t('common.detail.productName')}}：</label>
						<div class="table-row-right">
							<el-input type="text" maxlength="20" v-model="item.name" resize="none"/>
						</div>	
					</div>
					<div class="table-row flex">
						<label>{{$t('common.detail.productDetail')}}：</label>
						<div class="table-row-right">
							<el-input type="textarea" v-model="item.description" resize="none" maxlength="100" />
							<div class="table-row-btns">
								<span class="delete" @click="delCPList(item.id)">{{$t('common.btn.dele')}}</span>
							</div>
						</div>	
					</div>
					
					
				</div>
				<div class="table-row flex">
						<label>{{$t('common.detail.productTags')}}：</label>
						<!-- {{item.id}} -->
						<div class="table-row-right">
							<div class="table-row-tags">
								<el-tag
								  :key="n"
								  v-for="(tag,n) in productTagListed"
								  closable
								  :disable-transitions="false"
								  @close="delCPLab(tag)">
								  {{tag.text}}
								</el-tag>
								<el-input
								  class="input-new-tag"
								  v-if="inputVisible"
								  v-model="inputValue"
								  ref="saveTagInput"
								  size="small"
								  @keyup.enter.native="handleInputConfirm"
								  @blur="handleInputConfirm"
								>
								</el-input>
								<span class="add-btn" @click="addBtn({type:2})">+{{$t('common.btn.addTags')}}</span>
							</div>
							
						</div>	
						
					</div>
			</div>
			
			<!-- 企业简介 -->
			<div class="c-authen-box">
				<div class="zmlTitle">{{$t('common.company.companyBrief')}}</div>
				<div class="c-authen-jishu">
					<div class="table-row flex">
						<label>{{$t('common.detail.companyDetail')}}：</label>
						<div class="table-row-right">
							<el-input type="textarea" v-model="formData.enterpriseProfile" resize="none" maxlength="1000" />
						</div>	
					</div>
				</div>
			</div>
			
			<div class="c-authen-btn flexCenter">
				<button class="zmlBtn1" @click="zmlSubmit()" v-if="type == 0">
					<template v-if="formData.staffNumber.length == 0">{{$t('common.detail.submit')}}</template>
					<template v-else>{{$t('common.detail.saved')}}</template>
				</button>
				<button class="zmlBtn1" @click="zmlSubmit()" v-else>{{$t('common.company.certification')}}</button>
				<button class="zmlBtn3" @click="$router.go(-1)">{{$t('common.company.cancel')}}</button>
			</div>
			
		</div>
		<!-- 企业标签弹框 -->
		<div class="label-pup" v-if="pup && pupType == 1">
			<div class="label-box">
				<span class="pupHide flex-ct cur rd50" @click="pups()">×</span>
				<div class="label-selectEd">
					<span class="num">{{$t('common.btn.selected')}}(5/{{enterpriseTagListed.length}}）</span>
					<span class="li" v-for="(item, index) in enterpriseTagListed" :key='index'>{{item.text}}<i class="del-lab" @click="addLab(item)">×</i></span>
				</div>
				<dl class="label-all-list flex-lect">
					<dd class="li" :class="[item.show?'bg1':'']" v-for="(item, index) in enterpriseTagList" @click="addLab(item)" :key='index'>{{item.text}}</dd>
				</dl>
			</div>
		</div>
		<!-- 产品标签弹框 -->
		
		<div class="label-pup" v-if="pup && pupType==2">
			<div class="label-box">
				<span class="pupHide flex-ct cur rd50" @click="pups()">×</span>
				<div class="label-selectEd">
					<span class="num">{{$t('common.btn.selected')}}(5/{{productTagListed.length}}）</span>
					<span class="li" v-for="(item, index) in productTagListed" :key='index'>
					{{item.text}}
					<i class="del-lab" @click="addLab(item)">×</i></span>
				</div>
				<dl class="label-all-list flex-lect">
					<span class="li" :class="[item.show?'bg1':'']" v-for="(item, index) in productTagList" @click="addLab(item)" :key='index'>{{item.text}}</span>
				</dl>
			</div>
		</div>
		<!-- 所属行业弹窗 -->
		<div class="label-pup industry-pup" v-if="pup && pupType==3">
			<div class="label-box">
				<span class="pupHide flex-ct cur rd50" @click="pups()">×</span>
				<div class="label-selectEd">
					<span class="num">{{$t('common.btn.selected')}}(5/{{industryTypeListed.length}}）</span>
					<span class="li" v-for="(item, index) in industryTypeListed" :key='index'>
					{{item.text}}
					<i class="del-lab" @click="addLab(item)">×</i></span>
				</div>
				<dl class="label-all-list flex-lect">
					<span class="li" :class="[item.show?'bg1':'']" v-for="(item, index) in industryTypeList" @click="addLab(item)" :key='index'>{{item.text}}</span>
				</dl>
			</div>
		</div>
		
		<!-- 提交弹框 -->
		<el-dialog :visible.sync="dialogVisible" width="400px" center>
		  <div class="renzheng-dialog">
			  <strong class="font26">{{$t('common.tips.qyrz')}}</strong>
			  <p>{{$t('common.tips.qualifications')}}</p>
			  <p>{{$t('common.tips.complete')}} !</p>
		  </div>
		  <span slot="footer" class="dialog-footer">
		    <el-button class="zmlBtn1" type="primary" @click="perfectEnterpriseInfoSubmit()">{{$t('common.operate.confirm')}}</el-button>
		  </span>
		</el-dialog>
		<!-- 提示弹框 -->
		<el-dialog :visible.sync="submitTip" width="400px" center>
		  <div class="renzheng-dialog">
			  <strong class="font26">{{$t('common.tips.Tips')}}</strong>
				<p>{{submitTip_text}}</p>
		  </div>
		  <span slot="footer" class="dialog-footer">
		    <el-button class="zmlBtn1" type="primary" @click="submitTipClose()">{{$t('common.operate.confirm')}}</el-button>
		  </span>
		</el-dialog>
		
	</div>
</template>
<script>
import {ajax,ajaxAdd,beforeUpload} from '@/utils/js.js'
import {uploadFile,styleList,details,perfectEnterpriseInfo,certificationRequest} from '../../services/api.js'
import { showToast } from '@/utils/js.js'
const log = console.log
export default{
  data(){
      return{
				zmlSubmitShow:true,
				type:'',  //0-完善信息，1-完善信息+申请认证
				uploadFile:'/recruit-portal-api/v1/common/uploadFile',
				imgUrl:this.$store.state.imgUrl,
				imgs1:'',
				imgs2:'',
				
				corporateTypeList:[],
				
				inputVisible: false,
				inputValue: '',
				dialogVisible: false, //提交弹框
				enterpriseTagList:[], //企业标签
				enterpriseTagListed:[], //企业标签 选中
				productTagList:[],//产品标签
				productTagListed:[], //选中的产品标签

				industryTypeList:[], // 所属行业
				industryTypeListed:[],// 选中的所属行业
				industryText:'',
				staffNumberList:[], //员工人数

				labelList:[],//选中的标签
				pup:false,
				pupType:2,  // 1-企业标签，2-产品标签，3-所属行业
				submitTip:false,
				
				cpCurId:0,  //选择的认证id

				formData:{
					corporateType:'',	//企业类型/企业性质
					enterpriseInfo	:'',	//企业信息/经营范围
					enterpriseName	:'',	//企业名称
					enterpriseProfile	:'',	//企业简介
					enterpriseTag	:'',	//企业标签
					establishmentDate	:'',	//成立日期
					id	:'',	//企业信息ID
					ipcount:'',	//知识产权数量
					lawPerson	:'',	//法人代表
					logoId	:'',	//企业LOGO附件ID
					registeredCapital	:'',	//注册资本
					staffNumber	:'',	//员工人数
					status	:'',	//是否发起认证 1不发起认证，2发起认证
					uscc	:'',	//统一社会信用代码，
					address:'', //公司地址
					industry:'', //所属行业
					productTagList:'', //产品标签
					// 企业资质
					qualificationInformationList:[
						{
							attachment:{}, // 附件信息
							erId:'', //企业资源主键
							id:'', //	主键
							name	:'', //企业资质名称
							status	:'', //企业资质状态 1,未认证，2已认证
						}
					],
					technologyDirectionList:[],	//	核心技术与产品方向	
				},
				submitTip_text:{}, // 弹窗提示
				single:{
					description:'',	//核心技术或产品描述
					erId	:'',	//企业资源主键
					id	:0,	//主键
					name	:'',	//核心技术或产品名称
				},
				perfectEnterpriseInfoData:{}, //完善信息的数据
      }
	},
	methods:{
		jsUscc(){
      let val = this.formData.uscc
      this.formData.uscc = val.replace(/[^a-z0-9]/gi,'')
    },
		industryPup(e){
			this.pup = true;
			this.pupType = e
		},
		goback(){
			window.history.go(-1)
		},
		// 确认提交表单-参数提示信息
		zmlSubmit(){
			console.log('确认提交表单',this.formData)
			
			if(this.zmlSubmitShow){
				
				let data = this.formData
				
				let ajaxData = this.formData
				let newsTechnologyDirectionList = []
				let newEnterpriseTag = []
				
				//企业标签重构
				for(var key in data){
					if(key == 'enterpriseTagList'){
						ajaxData.enterpriseTagList = newsTechnologyDirectionList
					}else if(key == 'enterpriseTag'){
						for(let k=0;k<this.enterpriseTagListed.length;k++){
							newEnterpriseTag = newEnterpriseTag.concat(this.enterpriseTagListed[k].value)
						}
						ajaxData.enterpriseTag = newEnterpriseTag.toString()
					}else{
						ajaxData[key] = data[key]
					}

					

					
				}
				
				this.perfectEnterpriseInfoData = ajaxData
				if(!ajaxData.logoId) return this.submitTips(this.$t('common.tips.logo'))
				if(!ajaxData.qualificationInformationList[0].attachment) return this.submitTips(this.$t('common.form.up',[this.$t('common.company.companyQualification')]))
				if(!ajaxData.uscc) return this.submitTips(this.$t('common.form.input',[this.$t('common.company.companyCode')]))
				if(!ajaxData.lawPerson) return this.submitTips(this.$t('common.form.input',[this.$t('common.company.companyLegal')]))
				if(!ajaxData.registeredCapital) return this.submitTips(this.$t('common.form.input',[this.$t('common.company.companyCapital')]))
				if(!ajaxData.establishmentDate) return this.submitTips(this.$t('common.form.input',[this.$t('common.company.companyDate')]))
				if(!ajaxData.enterpriseInfo) return this.submitTips(this.$t('common.form.input',[this.$t('common.company.companyBusiness')]))
				if(!ajaxData.staffNumber) return this.submitTips(this.$t('common.form.input',[this.$t('common.company.companyEmployees')]))
				if(!ajaxData.ipcount) return this.submitTips(this.$t('common.form.select',[this.$t('common.company.companyIntellectual')]))
				if(!ajaxData.enterpriseTag) return this.submitTips(this.$t('common.form.select',[this.$t('common.company.companyTags')]))
				
				// 1-未认证，2-认证审核中，3-已认证
				if(data.status == 1 && this.type == 1){
					this.dialogVisible = true
				}else{
					this.perfectEnterpriseInfoSubmit()
				}
			}else{
				setTimeout(()=>{
					this.zmlSubmitShow = true
				},5000)
			}
			
		},
		//确认提交表单
		perfectEnterpriseInfoSubmit(){
			this.zmlSubmitShow = false
			ajaxAdd(this,perfectEnterpriseInfo,this.perfectEnterpriseInfoData,res=>{
				log('确认提交表单后',res)
				log('this.type',this.type)
				setTimeout(()=>{
					this.zmlSubmitShow = true
				},5000)
				if(this.type == 0){
					this.dialogVisible = false
					showToast(this,this.$t('common.tips.keepOk'),1)
					setTimeout(()=>{
						this.$router.push('/vip/c_recruit_companyInfo')
					},1500)
					
				}else{
					let data1 ={
						id:this.$store.state.userInfo.id
					}
					log('data1',data1)
					ajaxAdd(this,certificationRequest,{},d=>{
						this.goback();
						this.dialogVisible = false
					})
				}
			},err=>{
        setTimeout(()=>{
          this.dialogVisible = false
				},1000)
				setTimeout(()=>{
					this.zmlSubmitShow = true
				},5000)
      })
		},
		submitTips(msg){
			this.submitTip = true
			this.submitTip_text = msg
			setTimeout(()=>{
				this.submitTip=false
			},1500)
		},
		submitTipClose(){
			this.submitTip = false
		},
		addCPList(){
			let single={
					description:'',	//核心技术或产品描述
					erId	:'',	//企业资源主键
					id	:new Date().getTime(),	//主键
					name	:'',	//核心技术或产品名称
				}
				this.formData.technologyDirectionList = this.formData.technologyDirectionList.concat(single)
				log('添加产品后',this.formData)
		},
		// 删除产品列表
		delCPList(e){
			this.$confirm(this.$t('common.status.dele'), this.$t('common.status.tip'), {
				confirmButtonText: this.$t('common.operate.confirm'),
				cancelButtonText: this.$t('common.company.cancel'),
				type: 'warning'
			}).then(() => {
				this.perfectEnterpriseInfoData.technologyDirectionList = this.formData.technologyDirectionList.filter(n => n.id != e)
				this.formData.technologyDirectionList = this.formData.technologyDirectionList.filter(n => n.id != e)
			}).catch(() => {
									
			});
		},
		// 删除产品标签
		delCPLab(e){
			this.selectLab('productTagList','productTagListed',e,'productTag','productTagTxt')
		},
		
		// 选中标签后的操作
		selectLab(data,dataEd,e,conData,conDataTxt){
			if(!this[dataEd].find(n=>n.value == e.value)){
				if(this[dataEd].length>4){
					showToast(this,this.$t('common.tips.mores'))
				}else{
					this[dataEd] = this[dataEd].concat(e)
					this[data].find(n=>n.value == e.value).show = true
				}
			}else{
				this[dataEd] = this[dataEd].filter(n=>n.value != e.value)
				this[data].find(n=>n.value == e.value).show = false
			}
			var arry1=[],arry2=[]
			for(let i = 0; i<this[dataEd].length;i++){
				arry1 = arry1.concat(this[dataEd][i].value)
				arry2 = arry2.concat(this[dataEd][i].text)
			}
			this.formData[conData] = arry1.toString()
			this.formData[conDataTxt] = arry2.toString()
		},
		//选择标签
		addLab(e){
			// pupType1-企业标签，2-产品标签，3-所属行业
			let pupType = this.pupType
			if(pupType == 1){
				this.selectLab('enterpriseTagList','enterpriseTagListed',e,'enterpriseTag','enterpriseTagTxt')
				
			}else if(pupType == 2){
				this.selectLab('productTagList','productTagListed',e,'productTag','productTagTxt')
			}else{
				this.selectLab('industryTypeList','industryTypeListed',e,'industry','industryTxt')
				
				
			}
			
		},
		pups(){
			this.pup = !this.pup
		},
		
		
		
		//logo上传
		logoUpload(file){
			let data = new FormData()
			data.append('file', file)
			const typeList = ["jpg", "png"];
			beforeUpload(file,typeList,3072000,d=>{
				ajax(this,uploadFile,data,res=>{
					this.imgs1 = this.imgUrl+res.data.path
					this.formData.logoId = res.data.id;
					showToast(this,res.msg,1)

				})
				return false
			})
			
		},
		//资质上传
		intelligenceUpload(file){
			let data = new FormData()
			data.append('file', file)
			const typeList = ["jpg", "png"];
			beforeUpload(file,typeList,10000000,d=>{
				ajax(this,uploadFile,data,res=>{
					this.imgs2 = this.imgUrl+res.data.path;
					this.formData.qualificationInformationList[0].attachment = res.data;
					this.formData.qualificationInformationList[0].status = 1;
					showToast(this,res.msg,1)
				})
				return false
			})
			
		},
		addShow(data,name){
			this[name] = data
			console.log('data',data)
		},
		// 添加属性
		content(){
			//企业类型
			ajax(this,styleList,{lxjp:'corporateType'},res=>{
				this.corporateTypeList = res.data
			})
			// 属性
			ajax(this,styleList,{lxjp:'industry'},res=>{
				this.industryTypeList = res.data
				// this.addShow(res.data,'industryTypeList')
			})
			
			//企业标签
			ajax(this,styleList,{lxjp:'enterpriseTag'},res=>{
				this.enterpriseTagList = res.data
				// this.addShow(res.data,'enterpriseTagList')
			})
			//产品标签
			ajax(this,styleList,{lxjp:'productTag'},res=>{
				this.productTagList = res.data
				// this.addShow(res.data,'productTagList')
			})
			//员工人数
			ajax(this,styleList,{lxjp:'staffNumber'},res=>{
				this.staffNumberList = res.data
			})
			//企业信息
			ajaxAdd(this,details,{},res=>{
				let data = res.data
				console.log('企业信息',data)
				if(data){
					let formData = this.formData
					//产品标签显示
					if(data.productTag){
						let arrys = []
						let productTagList = data.productTag.split(',')
						let productTagListTxt = data.productTagTxt.split(',')
						let productTagLists = this.productTagList
						for(let i = 0; i < productTagList.length; i++){
							arrys = arrys.concat({text:productTagListTxt[i],value:productTagList[i]})
							let index = productTagLists.findIndex( n => n.value == productTagList[i] )
							productTagLists[index].show = true
						}
						this.productTagListed = arrys
					}
					//企业标签显示
					if(data.enterpriseTag){
						console.log('1111')
					}
					if(data.enterpriseTag && data.enterpriseTag.length>0){
						let arry = []
						let enterpriseTag = data.enterpriseTag.split(',')
						let enterpriseTagTxt = data.enterpriseTagTxt.split(',')
						let enterpriseTagList = this.enterpriseTagList
						for(let i=0;i<enterpriseTag.length;i++){
							arry = arry.concat({text:enterpriseTagTxt[i],value:enterpriseTag[i]})
							let index = enterpriseTagList.findIndex( n => n.value == enterpriseTag[i] )
							enterpriseTagList[index].show = true
						}
						this.enterpriseTagListed = arry
					}
					
					
					formData.corporateType=data.corporateType;	//企业类型/企业性质
					formData.enterpriseInfo	=data.enterpriseInfo;	//企业信息/经营范围
					formData.enterpriseName	=data.enterpriseName;	//企业名称
					formData.enterpriseProfile=data.enterpriseProfile;	//企业简介
					formData.enterpriseTag=data.enterpriseTag;	//企业标签
					formData.establishmentDate=data.establishmentDate;	//成立日期
					formData.id=data.id;	//企业信息ID
					formData.industry = data.industry
					formData.technologyDirectionList = data.technologyDirectionList
					formData.ipcount=data.ipcount;	//知识产权数量
					formData.lawPerson=data.lawPerson;	//法人代表
					for(let i=0;i<data.attachmentList.length;i++){
						if(data.attachmentList[i].belongType == 1){
							formData.logoId = data.attachmentList[i].id
							this.imgs1 = this.imgUrl+data.attachmentList[i].path
						}
					}
					formData.registeredCapital=data.registeredCapital || '';	//注册资本
					formData.staffNumber=data.staffNumber || '';	//员工人数
					formData.status=data.status || '';	//是否发起认证 1不发起认证，2发起认证
					formData.uscc=data.uscc || '';	//统一社会信用代码
					// 企业资质
					if(data.qualificationInformationList.length == 0){
						formData.qualificationInformationList = this.formData.qualificationInformationList 
					}else{
						formData.qualificationInformationList=data.qualificationInformationList
						data.qualificationInformationList[0].attachment ? this.imgs2 = this.imgUrl+data.qualificationInformationList[0].attachment.path : this.imgs2 = ''
					}
					formData.completionRate = data.completionRate
					formData.lawPerson = data.lawPerson  || ''
					formData.address = data.address  || ''
					
					this.formData = formData
					this.detail = data
					console.log('formData===>',formData)
				}
			})

		},
		
		//添加企业标签
		addBtn(e){
			this.pup=true;
			this.pupType = e.type
		},
		
		// 增加标签 删除标签
		handleClose(e) {
			this.selectLab('enterpriseTagList','enterpriseTagListed',e,'enterpriseTag','enterpriseTagTxt')
		},
		showInput() {
			this.inputVisible = true;
			this.$nextTick(_ => {
				this.$refs.saveTagInput.$refs.input.focus();
			});
		},
		handleInputConfirm() {
			let inputValue = this.inputValue;
			if (inputValue) {
				this.dynamicTags.push(inputValue);
			}
			this.inputVisible = false;
			this.inputValue = '';
		},
	},
	mounted(){
		this.content()
		log(this.$route.query)
		this.type = this.$route.query.type
		
	},
	watch:{
    '$i18n.locale'(){
      this.content()
    },
	},
	
	
}
</script>
<style lang="scss">
.label-pup{
	position: fixed;width: 100%;height: 100%;position: fixed;left: 0;top:0;z-index:99999;display:flex;align-items: center;justify-content: center;font-size:12px;
	.label-box{
		width:500px;
		background:rgba(255,255,255,1);
		box-shadow:0px 3px 6px rgba(0,0,0,0.16);
		opacity:1;
		border-radius:2px;
		position: relative;
		.pupHide{position: absolute;right: -6px;top: -6px;width:17px;height:17px;background:#868585;display:flex;align-items: center;justify-content: center;color: #fff;}
	}
	.li{
			line-height:16px;
			background:rgba(51,51,51,.05);
			margin-right: 1%;
			border-radius:2px;
			position: relative;
			cursor: pointer;
			margin-bottom:10px;
			width:24%;
			text-align: center;
			height:44px;
			display: flex;
			align-items: center;
			justify-content: center;
		}
		.del-lab{font-style: normal;position: absolute;right: -5px;top: -5px;cursor: pointer;width:20px;height: 20px;display: flex;align-items: center;justify-content: center;}
	.label-selectEd{
		padding-right:5px;
		box-sizing: border-box;
		width:100%;
		height:44px;
		background:rgba(214,215,220,.1);
		display:flex;align-items: center;justify-content: flex-start;
		margin-bottom: 10px;
		.li{
			width:auto;
			padding: 0 10px;
			margin-bottom: 0;
		}
	}
	.label-all-list{flex-wrap: wrap;max-height:400px;overflow-y: auto;}
	.label-all-list,.num{padding:0 10px;}
}
.table-row-tags{line-height: 32px;}
.table-row{line-height:32px;}

.c-authen-content{
	width: 100%;
	height: auto;
	background-color: #fff;
	padding: 0 140px 54px;
	.company-userinfo-head{
		padding: 30px 0;
		border-bottom: 1px solid #D1D1D1;
		.company-userinfo-head-img{
			width: 100px;
			height: 100px;
			overflow: hidden;
			background-color: #F5F5F5;
			color: #999;
		}
		.company-userinfo-head-text{
			flex: 1;
			padding: 5px 0;
			padding-left: 20px;
			justify-content: space-between;
			
		}
	}
	.c-authen-box{
		padding-bottom: 30px;
		border-bottom: 1px solid #d1d1d1;
		.company-userinfo-head{
			border-bottom: 0;
			padding: 0;
			.company-userinfo-head-img{
				height: 127px;
			}
			.company-userinfo-head-text{
				padding: 20px 0;
				padding-left: 20px;
			}
		}
		.c-authen-informa tr td:nth-child(2) .flexItems label{
			width:70px;
		}
		.c-authen-informa,
		.c-authen-jishu{
			width: 100%;
			padding: 0 15px;
			table{
				width: 100%;
				tr{
					td{
						padding: 6px 0;
						label{
							flex: 1;
							text-align: right;
							color: #666;
							white-space: nowrap;
						}
						.el-input{
							width: 180px;
						}
					}
				}
			}
			.table-row{
				padding: 6px 0;
				label{
					white-space: nowrap;
					color: #666;
					line-height: 32px;
				}
				.table-row-right{
					flex: 1;
					.button-new-tag,
					.input-new-tag{
						height: 28px;
						line-height: 28px;
					}
				}
				.el-textarea__inner{
					height: 120px;
				}
				.table-row-btns{
					padding-top: 22px;
					button{
						height: 34px;
					}
					.delete{
						color: #FF1F1F;
						text-decoration: underline;
						cursor: pointer;
					}
				}
			}
		}
		.c-authen-jishu{
			padding: 9px 15px;
		}
	}
	.c-authen-box:nth-last-of-type(2){
		border-bottom: 0;
	}
	.c-authen-btn{
		button{
			margin: 0 6px;
		}
	}
	.el-tag {
	    margin-right: 10px;
		background-color: rgba(51,51,51,0.05);
		border: 0;
		color: #333;
		height: 32px;
		line-height: 32px;
	}
	.el-tag .el-tag__close{
		color: #333;
	}
	.el-tag .el-tag__close:hover{
		background-color: #409EFF;
		color: #fff;
	}
	.button-new-tag {
	    margin-right: 10px;
	    height: 32px;
	    line-height: 30px;
	    padding-top: 0;
	    padding-bottom: 0;
	}
	.input-new-tag {
	    width: 90px;
	    margin-right: 10px;
	    vertical-align: bottom;
	}
}
.renzheng-dialog{
	color: #333;
	text-align: center;
	strong{
		display: inline-block;
		margin-bottom: 15px;
	}
	p{
		font-size: 16px;
		line-height: 24px;
	}
}
.c-authen{
	.company-userinfo-head-img img{
		width: 100%;
		height: 100%;
		object-fit: contain;
	}
	.el-button--primary{
		width: 133px;
		height: 42px;
		background-color: #0F54BC;
		border-color: #0F54BC;
	}
	.el-button--primary:focus, .el-button--primary:hover{
		background-color: #0F54BC;
		border-color: #0F54BC;
	}
	.zmlBtn3{width:84px;
		height:34px;
		border:1px solid rgba(178,178,178,1);
		opacity:1;
		border-radius:2px;
		background-color: #fff;
		cursor: pointer;
		padding:0
	}
}

.industry-pup .label-box{
	width:700px;
}
.industryBox{-webkit-appearance: none;
    background-color: #FFF;
    background-image: none;
    border-radius: 4px;
    border: 1px solid #DCDFE6;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    font-size: inherit;
    height: 40px;
    line-height: 40px;
    outline: 0;
    padding: 0 15px;
    transition: border-color .2s cubic-bezier(.645,.045,.355,1);
    width: 100%;}
    td.w1{width:33%;}
    td.w2{width:34%;}
    // td.w3{text-align: right;}
    .lab{width:70px;max-width:70px;min-width:70px;display: inline-block;vertical-align: middle;text-align: center;}
    // td .flexItems{justify-content: flex-end;}
</style>
